<?php
namespace app\car\api;
use think\Controller;
use think\Request;

class Comment extends Controller
{
    /**
     * 拼车评论
     * http://api.ybcpq.cn/car/comment/commentAdd
     */
    public function commentAdd()
    {
        $data = input("post.");

        $validate = validate("Comment");
        if(!$validate->check($data)){
            $result = array('code'=>VALIDATE_ERROR,'msg'=>'param error','data'=>'');
            return json($result);
        }

        $model = model("Comment");
        $res = $model->commentAdd($data);

        if($res !== false){
            $result = array('code'=>SUCCESS,'msg'=>'Success','data'=>'');
        }else{
            $result = array('code'=>ERROR,'msg'=>'Error','data'=>'');
        }
        return json($result);
    }
}